<f:view xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:sf="http://www.springframework.org/tags/faces"
  contentType="text/html" encoding="UTF-8">

  <h1 class="pageTitle">Result of your research</h1>
  <h:form>
    <h:commandLink action="back" title="back">
        Back to the home page
      </h:commandLink>
  </h:form>

  <br />

  <div class="doc">
    <hr />
    <c:forEach items="${conversationScope.result}" var="e">
      <div>
        <div class="resultRight">
          <div class="resultTitle">

            <h:form>
              <h:commandLink id="infos" value='#{e["Title"]}'
                action="detail"
                title='More information about : #{e["Title"]}'>
                <f:setPropertyActionListener value="#{e}"
                  target="#{flowScope.detailResultProductRow}" />
              </h:commandLink>
            </h:form>
          </div>

          <div>#{e["ProductGroup"]} / #{e["Binding"]}</div>
          <div>#{e["ListPrice.FormattedPrice"]}</div>
          <div>#{e["Studio"]}</div>
          <div>#{e["ReleaseDate"]}</div>
          <div>#{e["AudienceRating"]}</div>
          <div>#{e["Actor"]}</div>

          <c:if test="${currentUser.authorities[0] == 'ROLE_ADMIN'}">
            <h:form>
              <h:commandButton value="Add" action="addProduct"
                type="submit">
                <f:setPropertyActionListener value="#{e}"
                  target="#{flowScope.selectedObjectRow}" />
              </h:commandButton>
            </h:form>
          </c:if>
          <c:if test="${currentUser.authorities[0] == 'ROLE_USER'}">
            <h:form>
              <h:commandButton value="Add to cart" action="addProduct"
                type="submit">
                <f:setPropertyActionListener value="#{e}"
                  target="#{flowScope.selectedObjectRow}" />
              </h:commandButton>
            </h:form>
          </c:if>
        </div>

        <div class="resultLeft">
          <img src="#{e['LargeImage.URL']}" alt="image" width="150px"
            class="resultImage" />
        </div>
      </div>

      <hr />

    </c:forEach>
  </div>

  <br />

  <h:form>
    <h:commandLink action="back" title="back">
        Back to the home page
      </h:commandLink>
  </h:form>

</f:view>